package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

//<bean id="userService" class="com.itheima.service.impl.UserServiceImpl">
@Service("userService")
public class UserServiceImpl implements UserService {
    @Value("${jdbc.driver}")
    private String driver;

   //<property name="userDao" ref="userDao"></property>
   @Autowired//按照数据类型从Spring容器中进行匹配
   @Qualifier("userDao")//按照id值从容器中进行匹配的，但主要是此处的@Qulifier结合Autowired一起使用
   /* @Resource(name="userDao");*/
    private UserDao userDao;

    @Override
    public void save() {
        System.out.println(driver);
        userDao.save();
    }
}
